package san.entity.demo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

import com.dao.BaseEntity;

@Entity
@Table(name = "demo_news")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Indexed(index = "text_demo_news")
public class News extends BaseEntity {

	private static final long serialVersionUID = 2314266772042913358L;

	@Column(nullable = false, unique = true)
	@Field(name = "news_title", index = Index.TOKENIZED)
	private String title;

	@Field(name = "news_auth", index = Index.TOKENIZED)
	private String auth;

	@Column(length = 4000)
	@Field(name = "news_content", index = Index.TOKENIZED)
	private String content;

	private String picture;

	private Date newDate;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAuth() {
		return auth;
	}

	public void setAuth(String auth) {
		this.auth = auth;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public Date getNewDate() {
		return newDate;
	}

	public void setNewDate(Date newDate) {
		this.newDate = newDate;
	}

	@Override
	public String toString() {
		return this.title;
	}

}
